package com.java.util.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {

		registry.addInterceptor(new AdminInterceptor()).addPathPatterns("/admin/**")
		.excludePathPatterns("/admin/login", "/admin/logon", "/admin/logout");
		
		registry.addInterceptor(new UserInterceptor()).addPathPatterns("/user/**")
		.excludePathPatterns(
				"/user/index", 
				"/user/home", 
				"/user/login", 
				"/user/logon",
				
				"/user/getChapters", 
				"/user/getImitate", 
				"/user/initRecord"
				
				);
	}
}